<?xml version="1.0" encoding="ISO-8859-1"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui">
	<h:form id="formList">
		<div>
			<rich:panel header="#{messages['label.certificate']}" style="width: 400px; margin: auto;" rendered="#{empty certificateBean.application}">
				<table style="width: 100%;">
					<tr>
						<td style="width: 25%;"><h:outputText value="#{messages['label.application']}" /> : </td>
						<td style="width: 75%;">
							<rich:select value="#{certificateBean.applicationId}" selectFirst="false" enableManualInput="true" defaultLabel="#{messages['label.select']}" style="width: 250px;">
								<f:selectItems value="#{certificateBean.applications}" var="app" itemValue="#{app.id}" itemLabel="#{app.name}(#{app.alias})" />
								<a4j:ajax render="formList:btnSelect" />
							</rich:select>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="text-align: center;">
							<h:commandButton id="btnSelect" value="#{messages['label.select']}" action="#{certificateBean.select}" disabled="#{empty certificateBean.applicationId}" />
							<h:commandButton value="#{messages['label.cancel']}" action="#{certificateBean.end}"/>
						</td>
					</tr>
				</table>				
			</rich:panel>
			<rich:panel header="Certificate" style="width: 400px; margin: auto;" rendered="#{not empty certificateBean.application}">
				<table style="width: 100%;">
					<tr>
						<td style="width: 25%;"><h:outputText value="#{messages['label.application']}" /> : </td>
						<td style="width: 75%;">
							<h:outputText value="#{certificateBean.application.alias}"/>
							-
							<h:outputText value="#{certificateBean.application.name}"/>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="text-align: center;">
							<h:commandButton value="#{messages['label.new']}" action="#{certificateBean.newCertificate}"/>
							<h:commandButton value="#{messages['label.upload']}" action="#{certificateBean.uploadCertificate}"/>
							<h:commandButton value="#{messages['label.cancel']}" action="#{certificateBean.cancel}"/>
						</td>
					</tr>
				</table>
			</rich:panel>
			<br />
			<rich:dataTable rows="5" value="#{certificateBean.certificates}" var="cert" style="width: 500px; margin: auto;" rendered="#{not empty certificateBean.certificates}">
				<rich:column>
					<f:facet name="header">
						<h:outputText value="#{messages['label.alias']}" />
					</f:facet>
					<h:outputText value="#{cert.alias}" />
				</rich:column>
				<rich:column>
					<f:facet name="header">
						<h:outputText value="#{messages['label.subject']}" />
					</f:facet>
					<h:outputText value="#{cert.subject}" />						
				</rich:column>
				<rich:column>
					<f:facet name="header">
						<h:outputText value="#{messages['label.status']}" />
					</f:facet>						
					<h:outputText value="#{cert.status}" />
				</rich:column>
				<rich:column>
					<f:facet name="header">
						<h:outputText value="#{messages['label.action']}" />
					</f:facet>
					<h:commandLink alt="#{messages['label.view']}" title="#{messages['label.view']}" action="#{certificateBean.show}">
						<h:graphicImage name="edit-paste.png" library="images/nouveGnome/16x16/actions" />
						<f:setPropertyActionListener target="#{certificateBean.id}" value="#{cert.id}" />
					</h:commandLink>
				</rich:column>
				<f:facet name="footer">
					<rich:dataScroller maxPages="5" renderIfSinglePage="false" />
				</f:facet>
			</rich:dataTable>
		</div>
	</h:form>
</html>